
<div class="box box-success">
    <div class="box-header">
        <h1 class="box-title">基本信息</h1>
    </div>
    <div class="form-group">
        {!! Form::label('short_name', '企业简称:',['class'=>'col-sm-2 control-label']) !!}
        <input name="short_name" value="{{ old('short_name') ?: $data->short_name ?: '' }}" placeholder="如:信和巴巴" type="text"
               required>
        <span style="color: red">*必填</span>
    </div>

    <div class="form-group">
        {!! Form::label('company_name', '公司主体名称:',['class'=>'col-sm-2 control-label']) !!}
        <input name="company_name" value="{{ old('company_name') ?: $data->company_name ?: ''}}" placeholder="如:信和巴巴"
               type="text" required>
        <span style="color: red">*必填</span>
    </div>
    <div class="form-group">
        {!! Form::label('account_type', '账户类型:',['class'=>'col-sm-2 control-label']) !!}
        @foreach(\App\Models\Orm\CooperativeCompany::$account_type_text as $k => $v)
            {!! Form::checkbox(
            'account_type[]',
            $k,
            (!empty($data->account_type) && in_array($k, explode(',', $data->account_type)))
            ) !!} {{ $v }}
        @endforeach
        <span style="color: red">*必填</span>
    </div>


    <div class="form-group">
        {!! Form::label('login_email', '注册邮箱:',['class'=>'col-sm-2 control-label']) !!}
        <input name="login_email" value="{{ old('login_email') ?: $data->login_email ?: ''}}" placeholder="运营者登录邮箱"
               type="email" size="40" required>
        <span style="color: red">*必填</span>
    </div>
</div>
@section('js')
    <script>
        // 产品logo输入框自动显示已选图片
        $("input[name=pictrue]").change(function () {
            var obj = $(this).parents();
            var img = event.target.files[0];
            var id = 'logo';

            if (!img) {
                if ($('#' + id).length > 0) {
                    $('#' + id).remove()
                }
                return;
            }
            if (window.FileReader) {
                var im = document.createElement('img');
                im.id = id;
                if ($('#logo').length < 1) {
                    obj.append(im);
                }
                ;

                var fr = new FileReader();
                fr.onloadend = function (e) {
                    document.getElementById(id).src = e.target.result;
                    var imgObj = $('#' + id);
                    imgObj.css({
                        'width': '100px',
                        'height': '100px',
                    })
                };
                fr.readAsDataURL(img);
            }
        });
    </script>
@endsection